using Terra.Core.Security.Models;

namespace Terra.Core.Security.Services;

/// <summary>
/// JWT服务接口
/// </summary>
public interface IJwtService
{
    /// <summary>
    /// 生成访问令牌
    /// </summary>
    /// <param name="userIdentity">用户身份信息</param>
    /// <returns>访问令牌</returns>
    string GenerateAccessToken(UserIdentity userIdentity);

    /// <summary>
    /// 生成刷新令牌
    /// </summary>
    /// <returns>刷新令牌</returns>
    string GenerateRefreshToken();

    /// <summary>
    /// 验证访问令牌
    /// </summary>
    /// <param name="token">访问令牌</param>
    /// <returns>验证结果</returns>
    bool ValidateAccessToken(string token);

    /// <summary>
    /// 从令牌中获取用户身份信息
    /// </summary>
    /// <param name="token">访问令牌</param>
    /// <returns>用户身份信息</returns>
    UserIdentity GetUserIdentityFromToken(string token);
}